from django.contrib import admin
from django.utils.html import format_html

from .models import *
# Register your models here.

class ForumAdmin(admin.ModelAdmin):
    list_display = ('id','head_img','name','content','datatime')
    ordering = ('id',)
    list_filter = ('name',)
    def head_img(self, obj):
        return format_html('<img src="/{}" style="width:100px;height:auto;">', obj.head)
    head_img.short_description = '头像'

admin.site.register(forum, ForumAdmin)
